﻿@using KRM.Core
@model KRM.Core.vKRMRSViewReturn
@{
    var db = new KRMEntities();
    var order = db.tblOrders.FirstOrDefault(a => a.OrderRef == Model.OrderRef);
    var dispute = db.tblKRMRSDisputes.Find(Model.DisputeID);
}

@Html.Partial("Partial/_MessageResult")
<div class="row-fluid">
    <div class="span5">
        <div class="border-padding10">
            <div class="row-fluid">
                <div class="span4">Order Item</div>
                <div class="span8">
                    <input type="text" class="input-block-level" value="@Model.Order_Item" readonly="readonly" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">Collection Date</div>
                <div class="span8">
                    <input type="text" class="input-block-level" value="@Model.Collection_Date" readonly="readonly" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">Collection Items</div>
                <div class="span8">
                    <input type="text" class="input-block-level" value="@Model.CollectionItems" readonly="readonly" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">Collection Fee</div>
                <div class="span3">
                    @Model.CollectionFee
                </div>
                <div class="span5">
                    @if (order.IsFreeReturn())
                    {
                        <h1 style="color: green">Free Return</h1>
                    }
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">Parcels Expected</div>
                <div class="span2">
                    <input type="text" class="input-block-level" value="@Model.Parcels_Expected" readonly="readonly" />
                </div>
                <div class="span4">Parcels Received</div>
                <div class="span2">
                    <input type="text" class="input-block-level" value="@Model.Parcels_Received" readonly="readonly" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">Reason for Return</div>
                <div class="span8">
                    <input type="text" class="input-block-level" value="@Model.Reason" readonly="readonly" />
                </div>
            </div>
        </div>
    </div>

    <div class="span7">
        <div class="border-padding10" style="height: 230px; overflow: auto">
            @*<button class="btn btn-success" onclick="PopupCenter('/rdm/addphotodispute?disputeid=@Model.DisputeID',600, 400)">Add Image</button><br />*@
            <div class="tbl-photodispute">
                @Html.Action("PhotosDispute", "Rdm", new {disputeid = Model.DisputeID})
            </div>
        </div>
    </div>
</div>
<fieldset>
    <legend>Parcel list</legend>
    <div style="height: 150px; overflow: auto">
        <table class="table table-bordered table-fix tbl-selected">
            <thead>
                <tr>
                    <th>Date Received</th>
                    <th>NumberOfParcels</th>
                    <th>Parcels Contents</th>
                    <th>Condition</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in db.vKRMRSReturnParcels.Where(a => a.DisputeID == Model.DisputeID))
                {
                    <tr style="cursor: pointer" onclick="parcelselected(@item.ParcelID, @item.DisputeID)">
                        <td>@item.DateReceived</td>
                        <td>@item.NumberOfParcels</td>
                        <td>@item.ParcelContents</td>
                        <td>@item.Condition</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</fieldset>
<div class="border-padding10 text-right">
    <a  href="/rdm/InspectionForm?disputeid=@Model.DisputeID" class="btn">Inspection Form</a>
    <a href="/orderview/orderdetail?orderref=@Model.OrderRef" target="_blank" class="btn">View Order</a>
    <button type="button" class="btn btn-danger btn-removeparcel">Remove Parcel</button>
    <button type="button" class="btn btn-success" onclick="PopupCenter('/rdm/addparcel?returnid=@Model.ReturnID&disputeid=@Model.DisputeID',900, 400)">Add Parcel</button>
</div>
